package com.ucl.web.controller.upload;

import com.ucl.model.common.ApiResult;
import com.ucl.model.vo.flowsearch.MifiVO;
import com.ucl.model.vo.flowsearch.OperatorVO;
import com.ucl.model.vo.flowsearch.SimVO;
import com.ucl.service.flowsearch.MifiService;
import com.ucl.service.flowsearch.OperatorService;
import com.ucl.service.flowsearch.SimService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/upload/excel")
public class ExcelUploadController {

    @Autowired
    private SimService simService;

    @Autowired
    private MifiService mifiService;

    @Autowired
    private OperatorService operatorService;

    @PostMapping("/simData")
    public ApiResult simData(@RequestBody List<SimVO> simVOList) {
        simService.insertSimData(simVOList);
        return ApiResult.ok();
    }

    @PostMapping("/mifiData")
    public ApiResult mifiData(@RequestBody List<MifiVO> mifiVOList) {
        mifiService.insertMifiData(mifiVOList);
        return ApiResult.ok();
    }

    @PostMapping("/operatorData")
    public ApiResult operatorData(@RequestBody List<OperatorVO> operatorVOList) {
        operatorService.insertOperatorData(operatorVOList);
        return ApiResult.ok();
    }
}
